<style lang="scss" scoped>
@import '../../styles/common/loading.less';
.container{
    border: none !important;
    margin-top: 4px;
}
.el-col-offset-1 {
    margin-left: 0%;
}
.button_a {
    background-color: rgba(255, 138, 0, 1);
    border-color: rgba(255, 138, 0, 1);
}
.col_a {
    margin-left: 2%;
}
.el-card {
    height: 200px;
}
.el-button--primary {
    background-color: rgba(255, 138, 0, 1);
    border-color: rgba(255, 138, 0, 1);
}
</style>
<template>
    <div  class="common-background-color"
          v-loading="loading"
          element-loading-text="loading......"
          element-loading-spinner="el-icon-loading"
          element-loading-background="rgba(0, 0, 0, 0.8)">
        <div style="width:98%;height:85%;margin: 36px 12px;margin-right: 50px;">
              <el-collapse v-model="activeNames">
                  <el-collapse-item title="结算汇总信息"  name="1">
                      <el-form :model="prpLSettlementDTO" class="info-submit-form">
                          <el-row type="flex">
                              <el-col :span="8">
                                  <el-form-item label="医疗机构名称">
                                      <el-input v-model="prpLSettlementDTO.hospName" disabled></el-input>
                                  </el-form-item>
                              </el-col>
                              <el-col :span="8">
                                  <el-form-item label="结算笔数">
                                      <el-input v-model="prpLSettlementDTO.settleNum"  disabled></el-input>
                                  </el-form-item>
                              </el-col>
                              <el-col :span="8">
                                  <el-form-item label="医疗费用总额">
                                      <el-input v-model="prpLSettlementDTO.medicalFeeAmount" disabled></el-input>
                                  </el-form-item>
                              </el-col>
                          </el-row>
                          <el-row type="flex">
                              <el-col :span="8">
                                  <el-form-item label="扣款金额">
                                      <el-input v-model="prpLSettlementDTO.deductionAmount"  disabled></el-input>
                                  </el-form-item>
                              </el-col>
                              <el-col :span="8">
                                  <el-form-item label="应补金额">
                                      <el-input v-model="prpLSettlementDTO.supplementAmount" disabled></el-input>
                                  </el-form-item>
                              </el-col>
                              <el-col :span="8">
                                  <el-form-item label="实际支付金额">
                                      <el-input v-model="prpLSettlementDTO.actualPaymentAmount" disabled></el-input>
                                  </el-form-item>
                              </el-col>
                          </el-row>
                      </el-form>
                  </el-collapse-item>
              </el-collapse>
              <el-collapse  v-model="activeNames">
                  <el-collapse-item title="账号信息"  name="2">
                      <el-form ref="prpLPayee" :model="prpLPayee" :rules="rulesPayee" class="info-submit-form"> 
                          <!--                        第1行-->
                          <el-row type="flex" >
                              <el-col :span="8">
                                  <el-form-item label="领款人名称" prop="payeeName" :required="false">
                                      <el-input  style="margin-top: 5px" v-model="prpLPayee.payeeName" placeholder="">
                                          <el-button slot="append" @click="accountDialogVisible = true" icon="el-icon-search"></el-button>
                                      </el-input>
                                  </el-form-item>
                              </el-col>
                              <el-col :span="8">
                                  <el-form-item label="支付对象"  prop="payObject" :required="false">
                                        <el-select placeholder="请选择" v-model="prpLPayee.payObject" >
                                            <el-option
                                            v-for="item in payObjectList"
                                            :key="item.codeCode"
                                            :label="item.codeCName"
                                            :value="item.codeCode">
                                            </el-option>
                                        </el-select>
                                  </el-form-item>
                              </el-col>
                              <el-col :span="8" >
                                  <el-form-item label="联系电话">
                                      <el-input   v-model="prpLPayee.phone"  placeholder=""></el-input>
                                  </el-form-item>
                              </el-col>
                          </el-row>
                          <!--                        第2行-->
                          <el-row type="flex">
                              <el-col :span="8" >
                                  <el-form-item label="证件类型">
                                      <el-select  placeholder="请选择" v-model="prpLPayee.identifyType" >
                                          <el-option
                                            v-for="item in identifyTypeList"
                                            :key="item.codeCode"
                                            :label="item.codeCName"
                                            :value="item.codeCode">
                                          </el-option>
                                      </el-select>
                                  </el-form-item>
                              </el-col>
                              <el-col :span="8"  >
                                  <el-form-item label="证件号码">
                                      <el-input v-model="prpLPayee.identifyNo"   placeholder=""></el-input>
                                  </el-form-item>
                              </el-col>
                              <el-col :span="8">
                                  <el-form-item label="收款银行大类" prop="bankBroad" :required="false">
                                      <el-select placeholder="请选择" v-model="prpLPayee.bankBroad" @change="changeBankBroad">
                                          <el-option
                                          v-for="item in bankBroadList"
                                          :key="item.directCode"
                                          :label="item.directName"
                                          :value="item.directCode">
                                          </el-option>
                                      </el-select>
                                  </el-form-item>
                              </el-col>
                          </el-row>
                          <!--                        第3行-->
                          <el-row type="flex">
                              <el-col :span="8" >
                                  <el-form-item label="开户行省" prop="province">
                                      <el-select placeholder="请选择省份" v-model="selectProvince" filterable size="mini"  @change="selectProvinceFun($event)" >
                                          <el-option value="" label="请选择"></el-option>
                                          <el-option :value="item" :label="item.label" v-for="(item, index) in provinceList" :key="index"></el-option>
                                    </el-select>
                                  </el-form-item>
                              </el-col>
                              <el-col :span="8"  >
                                  <el-form-item label="开户行市" prop="area">
                                      <el-select placeholder="请选择城市" v-model="selectCity" filterable size="mini" @change="selectCityFun($event)" >
                                          <el-option value="" label="请选择"></el-option>
                                          <el-option :value="item" :label="item.label" v-for="(item, index) in cityList" :key="index"></el-option>
                                      </el-select>
                                  </el-form-item>
                              </el-col>
                              <el-col :span="8">
                                  <el-form-item label="开户行区/县" prop="city">
                                      <el-select placeholder="请选择区县" v-bind:disabled="isAble02"  v-model="selectDistrict" filterable size="mini"  @change="selectDistrictFun($event)" >
                                          <el-option value="" label="请选择"></el-option>
                                          <el-option :value="item" :label="item.label" v-for="(item, index) in districtList" :key="index"></el-option>
                                      </el-select>
                                  </el-form-item>
                              </el-col>
                          </el-row>
                          <!--                        第4行-->  
                          <el-row type="flex">
                              <el-col :span="8" >
                                  <el-form-item label="开户银行">
                                      <el-select placeholder="请选择" v-bind:disabled="isAble" v-model="prpLPayee.bankCode"  @change="changeBankInfo" >
                                          <el-option
                                          v-for="item in bankInfoList"
                                          :key="item.bankCode"
                                          :label="item.bankName"
                                          :value="item.bankCode">
                                          </el-option>
                                      </el-select>
                                  </el-form-item>
                              </el-col>
                              <el-col :span="8" >
                                  <el-form-item label="对公对私" prop="bankToPubPri"  :required="false">
                                      <el-select  placeholder="请选择" v-model="prpLPayee.bankToPubPri" >
                                          <el-option
                                            v-for="item in pubPriList"
                                            :key="item.codeCode"
                                            :label="item.codeCName"
                                            :value="item.codeCode">
                                          </el-option>
                                      </el-select>
                                  </el-form-item>
                              </el-col>
                              <el-col :span="8">
                                  <el-form-item label="银行账号"  prop="bankNo" :required="false">
                                      <el-input  v-model="prpLPayee.bankNo"     placeholder=""></el-input>
                                  </el-form-item>
                              </el-col>
                          </el-row>
                          <!--                        第5行-->
                          <el-row type="flex">
                              <el-col :span="8"  >
                                  <el-form-item label="银行地址"  prop="bankAddress" :required="false">
                                      <el-input   v-model="prpLPayee.bankAddress"  placeholder=""></el-input>
                                  </el-form-item>
                              </el-col>
                              <el-col :span="8" >
                                  <el-form-item label="赔款金额"  prop="payAmount" :required="false">
                                      <el-input  v-model="prpLPayee.payAmount"   placeholder=""></el-input>
                                  </el-form-item>
                              </el-col>
                              <el-col :span="8" >
                                  <el-form-item label="赔款摘要" prop="remark"  :required="false">
                                      <el-input  v-model="prpLPayee.remark"     placeholder=""></el-input>
                                  </el-form-item>
                              </el-col>
                          </el-row>
                      </el-form>
                  </el-collapse-item>
              </el-collapse>
        </div>
        <!-- 编辑弹出框 -->
        <el-dialog
            title="结算单明细"
            :visible.sync="centerDialogVisible" append-to-body
            width="70%"
            center>
            <div>
                <template>
                    <el-table
                    :data="settleCaseInfoList"
                    class="table"
                    ref="multipleTable"
                    header-cell-class-name="table-header"
                    style="margin-top: 30px" 
                    >
                        <el-table-column prop="caseNo" label="大病赔案号"  width="165" align="center">
                            <template  slot-scope="scope">
                                <a href="#">{{scope.row.caseNo}}</a>
                            </template>
                        </el-table-column>
                        <el-table-column prop="medicalType" label="医疗类别" align="center"></el-table-column>
                        <el-table-column prop="sumAmount" label="医疗费用金额" align="center"></el-table-column>
                        <el-table-column prop="undwrtDate" label="核赔日期"  width="150" align="center"></el-table-column>
                        <el-table-column prop="sumPayAmount" label="实际支付金额" align="center"></el-table-column>
                    </el-table>
                    <!-- <div class="pagination">
                    <el-pagination
                        background
                        layout="prev, pager, next"
                        :total="1">
                    </el-pagination>
                    </div> -->
                </template>
            </div>
            <div slot="footer" class="dialog-footer">
                <el-button type="info" @click="centerDialogVisible = false">关  闭</el-button>
            </div>
        </el-dialog>
        <!-- 账号选择弹框 -->
        <el-dialog
            title="账户信息"
            :visible.sync="accountDialogVisible"
            class="class_c"
            width="70%"
            center>
            <div>
            <template>
                <div>
                <!-- <div class="crumbs">
                    <div style="margin:10px;font-family: 'MicrosoftYaHei-Bold', '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑', sans-serif;
                font-weight: 700;
                font-style: normal;
                font-size: 14px;
                line-height: 22px;">账户信息查询
                    </div>
                </div> -->
                <div class="container">
                    <div>
                    <el-form :model="prplPayeeList" ref="prplPayeeList">
                        <el-row type="flex">
                            <el-col :span="12">
                                <el-form-item label="领款人姓名" prop="payeeName">
                                <el-input placeholder="请输入领款人名称"  v-model="prplPayeeList.payeeName"></el-input>
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item label="证件号码" prop="identifyNo">
                                <el-input placeholder="请输入证件号" v-model="prplPayeeList.identifyNo"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row type="flex">
                            <el-col :span="12">
                                <el-form-item label="银行账户后六位" prop="bankNo">
                                <el-input placeholder="请输入账户后六位"  v-model="prplPayeeList.bankNo"></el-input>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="24">
                                <div class="select-btn-group">
                                <el-button type="primary" size="medium"  @click="queryAccountList">查询</el-button>
                                <el-button type="primary" size="medium" @click="resetForm('prplPayeeList')">重置</el-button>
                                </div>
                            </el-col>
                        </el-row>
                    </el-form>
                    </div>
                    <el-table
                    :data="prplPayeeData"
                    class="table"
                    ref="multipleTable"
                    header-cell-class-name="table-header"
                    style="margin-top: 10px"
                    >
                    <el-table-column type="index" label="序号" width="55px" align="center"></el-table-column>
                    <el-table-column prop="payeeName" label="领款人名称" align="center">
                        <template slot-scope="scope">
                            <a href="#" style="color: #409EFF" @click="showDetails(scope.row)">{{scope.row.payeeName}}</a>
                        </template>
                    </el-table-column>
                    <el-table-column prop="identifyNo" label="证件号码"  width="160" align="center"></el-table-column>
                    <el-table-column prop="bankNo" label="银行账号" width="150" align="center"></el-table-column>
                    <el-table-column prop="bankName" label="开户银行" align="center"></el-table-column>
                    <el-table-column prop="bankToPubPri" label="对公对私" align="center" :formatter="formatBankToPubPri"></el-table-column>
                    <el-table-column prop="phone" label="联系电话" align="center"></el-table-column>
                    <!-- <el-table-column label="操作栏" align="center" show-overflow-tooltip width="200px">
                        <template slot-scope="scope">
                        <el-button type="text" @click="showDetails(scope.row)">选定</el-button>
                        </template>
                    </el-table-column> -->
                    </el-table>
                    <div class="pagination">
                    <el-pagination :current-page="accpagination.currentPage" :page-size="accpagination.rowsNumber"
                                    :total="accpagination.totalPage" background layout="prev, pager, next,total,jumper"
                                    @current-change="accQueryFun">
                    </el-pagination>
                    </div>
                    <!--关闭按钮-->
                    <!-- <div style="margin-left: 45%">
                    <el-button type="primary" @click="accountDialogVisible = false"
                                style="line-height:10px;height: 35px;width: 100px;text-align: center;margin: 10px 0px 0px 0px;">
                        关闭
                    </el-button>
                    </div> -->

                </div>
                </div>
            </template>
            </div>
            <div slot="footer" class="dialog-footer">
                <el-button type="info" @click="accountDialogVisible = false">关  闭</el-button>
            </div>
        </el-dialog>
        <div style="margin-top: 25px;text-align: center;height: 70px">
            <el-button type="success" size="medium" style="width: 9%" @click="settleDetail" >结算单明细</el-button>
            <el-button type="success" size="medium" style="width: 9%" v-on:click="onSubmit" >提交</el-button>
            <el-button type="success" size="medium" style="width: 9%" @click="handleClose">关闭</el-button>
        </div>
        <!-- <div style="margin: 40px;padding-bottom: 50px;margin-left: 35%;">
            <el-button type="primary" size="medium" style=" background-color:rgba(255, 138, 0, 1);
            border-color:rgba(255, 138, 0, 1);">重置</el-button>
            <el-button type="danger"  size="medium" @click="settleDetail" style=" background-color:rgba(255, 138, 0, 1);
            border-color:rgba(255, 138, 0, 1);">结算单明细</el-button>
            <el-button type="success" size="medium" v-on:click="onSubmit" style=" background-color:rgba(255, 138, 0, 1);
            border-color:rgba(255, 138, 0, 1);">提交</el-button>
            <el-button type="info" size="medium" @click="handleClose" style=" background-color:rgba(255, 138, 0, 1);
            border-color:rgba(255, 138, 0, 1);">关闭</el-button>
        </div> -->
    </div>
</template>

<script>
import util from '@/libs/util';
import{queryCodeList,queryBankClassList,queryBankInfo,queryBankRegionTree,queryRegionTree,submitSettlement,querySettleCaseInfo,queryAccountListByPage}from '@/api/baseDate';
import Cookies from 'js-cookie';
import moment, { relativeTimeRounding } from 'moment';
export default {
    name: 'settlementTaskDetail',
    data() {
        return {
            loading:false,
            isAble:true,
            isAble02:true,
            activeNames: ['1','2'],
            centerDialogVisible:false, // 结算单明细
            accountDialogVisible:false, // 账户选择弹框
            data:{
                prpLPayee:{}
            },
            prpLSettlementDTO: {
                handlerComCode: '',
                handlerComName: '',
                handlerCode: '',
                handlerName: '',
            },
            prpLPayee:{
              bankBroad:'',
              bankName:'',
              bankCode:'',
              bankProvince:'',
              bankCity:'',
              bankDistrict:'',
              bankDistrictName:'',
              bankAddress:'',
            },
            settleCaseInfoList:[],
            prpLClaimOpinionDTO:{},
            selectProvince: {},
            selectCity: {},
            selectDistrict: {},
            isAccount:false,
            payObjectList:[],
            identifyTypeList:[],
            bankBroadList:[],
            provinceList:[],
            cityList:[],
            districtList:[],
            bankInfoList:[],// 银行信息
            bankType:'', // 银行类型编号
            pubPriList:[ // 
                {
                    codeCode:"1",
                    codeCName:"对公",
                },
                {
                    codeCode:"2",
                    codeCName:"对私",
                }
            ],
            pagination: {
              currentPage: 1, // 当前页
              rowsNumber: 10, // 每页条数
              totalPage: 0 // 总条数
            },
            //账户查询分页
            accpagination: {
              currentPage: 1, // 当前页
              rowsNumber: 5, // 每页条数
              totalPage: 0 // 总条数
            },
            prplPayeeList:{},
            prplPayeeData:[],
            rulesPayee: {
                payeeName: [{ required: true, message: "必填字段", trigger: "blur" }],
                payObject: [{ required: true, message: "必填字段", trigger: "blur" }],
                bankBroad: [{ required: true, message: "必填字段", trigger: "blur" }],
                bankAddress: [{ required: true, message: "必填字段", trigger: "blur" }],
                bankNo: [{ required: true, message: "必填字段", trigger: "blur" }],
                payAmount: [{ required: true, message: "必填字段", trigger: "blur" }],
                remark: [{ required: true, message: "必填字段", trigger: "blur" }],
                bankToPubPri: [{ required: true, message: "必填字段", trigger: "blur" }],
                paymentType: [{ required: true, message: "必填字段", trigger: "blur" }],
            },
        }
    },
    created() {
        this.initTaskDetail();
        this.queryPayObjectList();
        this.queryIdentifyTypeList();
        this.queryBankBroadList();
        this.queryRegionList();
    },
    methods: {
        handleSizeChange(pageSize){ // 改变当前页条数事件
            let pageIndex = this.pagination.currentPage;
            this.queryTaskList(pageIndex,pageSize);
        },
        queryFun(pageNum){ // 改变当前页事件
            let rowsNumber = this.pagination.rowsNumber;
            this.queryTaskList(pageNum,rowsNumber);
        },
        costSumInfo(){
            this.isAccount=!this.isAccount;
        },
        // 初始页面
        initTaskDetail(){
            this.loading = true;
            this.prpLSettlementDTO = {
                comCode: this.$route.params.comCode,
                comName: this.$route.params.comName,
                hospName: this.$route.params.hospName,
                hospCode: this.$route.params.hospCode,
                isReopen: this.$route.params.isReopen,
                settleNum: this.$route.params.settleNum,
                medicalFeeAmount: this.$route.params.medicalFeeAmount,
                deductionAmount: this.$route.params.deductionAmount,
                supplementAmount: this.$route.params.supplementAmount,
                actualPaymentAmount: this.$route.params.actualPaymentAmount
                
            }
            this.settleCaseInfoList = this.$route.params.settleCaseInfoList;
            this.prpLPayee.payAmount = this.prpLSettlementDTO.actualPaymentAmount;
            this.loading = false;
        },
        // 支付对象
        queryPayObjectList(){
            const param = {
                codeType:'PayObject'
            }
            queryCodeList(param).then(res=> {
                this.payObjectList = res.data
            })
        },
        // 证件类型
        queryIdentifyTypeList(){
            const param = {
                codeType:'IdentifyType'
            }
            queryCodeList(param).then(res=> {
                this.identifyTypeList = res.data
            })
        },
        // 银行大类
        queryBankBroadList(){
            queryBankClassList('').then(res=> {
                this.bankBroadList = res.data
            })
        },
        // 监听银行大类改变事件
        changeBankBroad(val){
            this.bankInfoList = [];
            this.prpLPayee.bankCode = '';
            this.prpLPayee.bankAddress = '';
            this.selectDistrict = '';
            this.prpLPayee.bankDistrict = '';
            this.bankBroadList.map((item)=>{
                if(item.directCode === val){
                    this.bankType = item.bankType;
                    if(item.isDefault === '0'){
                        this.isAble02 = false;
                        this.isAble = false;
                        this.querybankList();
                    }else{
                        this.isAble02 = true;
                        this.isAble = true;
                        this.prpLPayee.bankAddress = item.bankName;
                    }
                }
            })
        },
        // 查询银行信息
        querybankList(){
            let bankType = this.bankType;
            let areaCode = this.prpLPayee.bankDistrict;
            if (bankType == '' || bankType == undefined || bankType == null){
                //this.$message.warning(`请选择银行大类！`);
                return;
            }
            if (areaCode == '' || areaCode == undefined || areaCode == null){
                //this.$message.warning(`请选择开户行县！`);
                return;
            }
            const param = { 
                bankType: bankType,
                areaCode: areaCode
            }
            queryBankInfo(param).then(res=> {
                this.bankInfoList = res.data
                if(this.bankInfoList.length > 0){
                    this.isAble = false;
                }else{
                    this.isAble = true;
                }
            })
        },
        // 开户银行改变事件
        changeBankInfo(val){
            this.bankInfoList.map((item)=>{
                if(item.bankCode === val){
                    this.prpLPayee.bankName = item.bankName;
                    this.prpLPayee.bankCode = item.bankCode;
                    this.prpLPayee.bankAddress = item.bankName;
                }
            })
        },
        // 查询银行区域数据
        queryRegionList(){
            queryBankRegionTree('').then(res=> {
                this.provinceList = res.data
            })
        },
        // 省份 市 县联动
        selectProvinceFun (event) {
            console.log(event)
            if (event) {
                this.cityList = event.children
            } else {
                this.cityList = []
            }
            this.districtList = []
            this.$emit('getLawyerListInfo', [event.label, 'province'])
            this.selectDistrict = {};
            if (event.value === undefined) {
                this.prpLPayee.bankProvince = "";
            } else {
                this.prpLPayee.bankProvince = event.value;
            }
            this.bankInfoList = [];
            this.prpLPayee.bankCode = '';
        },
        selectCityFun (event) {
            console.log(event)
            if (event) {
                this.districtList = event.children
            } else {
                this.districtList = []
            }
            this.$emit('getLawyerListInfo', [event.label, 'city'])
            if (event.value === undefined) {
                this.prpLPayee.bankCity = "";
            } else {
                this.prpLPayee.bankCity = event.value;
            }
            this.bankInfoList = [];
            this.prpLPayee.bankCode = '';
        },
        selectDistrictFun (event) {
            console.log(event)
            this.$emit('getLawyerListInfo', [event.label, 'area'])
            if (event.value === undefined) {
                this.prpLPayee.bankDistrict = "";
                this.prpLPayee.bankDistrictName = '';
            } else {
                this.prpLPayee.bankDistrict = event.value;
                this.prpLPayee.bankDistrictName = event.label;
            }
            this.bankInfoList = [];
            this.prpLPayee.bankCode = '';
            this.prpLPayee.bankAddress = '';
            this.querybankList();
        },
        // 结算单明细
        settleDetail(){
            this.centerDialogVisible = true;
        },
        //账户信息分页
        accQueryFun(pageNum){ // 改变当前页事件
          this.accpagination.currentPage=pageNum
          this.queryAccountList();
        },
        // 查询账户信息列表
        queryAccountList(){
            queryAccountListByPage({
              bankNo: this.prplPayeeList.bankNo,
              identifyNo: this.prplPayeeList.identifyNo,
              payeeName: this.prplPayeeList.payeeName,
              pageNum: this.accpagination.currentPage,
              pageSize: this.accpagination.rowsNumber,
               comCode: Cookies.get("makeCom"),
            }).then(res => {
              this.prplPayeeData = res.data.list;
              this.accpagination.totalPage = res.data.total;;
            })
        },
        resetForm(formName) {
            this.$refs[formName].resetFields();
        },
        showDetails(row){
            this.prpLPayee = {};
            this.accountDialogVisible = false;
            this.prpLPayee.payAmount = this.prpLSettlementDTO.actualPaymentAmount;
            this.prpLPayee.payeeName = row.payeeName
            this.prpLPayee.identifyType = row.identifyType
            this.prpLPayee.identifyNo = row.identifyNo
            this.prpLPayee.bankBroad = row.bankBroad
            this.prpLPayee.bankToPubPri = row.bankToPubPri
            this.prpLPayee.bankCode = row.bankCode
            this.prpLPayee.bankName = row.bankName
            this.prpLPayee.bankNo = row.bankNo
            this.prpLPayee.phone = row.phone
            this.prpLPayee.bankProvince = row.bankProvince;
            this.prpLPayee.bankCity = row.bankCity;
            this.prpLPayee.bankDistrict = row.bankDistrict;
            this.prpLPayee.bankDistrictName = row.bankDistrictName;
            this.prpLPayee.bankAddress = row.bankAddress;

            // 回显省市区
            this.selectProvince=this.provinceList.filter(ele => ele.value==row.bankProvince)[0]
            this.cityList = this.selectProvince.children;
            this.selectCity=this.selectProvince.children.filter(ele => ele.value==row.bankCity)[0]
            this.districtList = this.selectCity.children
            this.selectDistrict=this.selectCity.children.filter(ele => ele.value==row.bankDistrict)[0]

            // 回显银行大类
            if(this.prpLPayee.bankBroad != ''){
                // 回显银行信息
                this.bankBroadList.map((item)=>{
                    if(item.directCode === this.prpLPayee.bankBroad){
                        this.bankType = item.bankType;
                        if(item.isDefault === '0'){
                            this.isAble02 = false;
                            this.isAble = false;
                            this.querybankList();
                        }else{
                            this.isAble02 = true;
                            this.isAble = true;
                        }
                    }
                })
            }
        },
        // 关闭页面
        handleClose(){
            this.closePageTo(this.$store,this.$route,this.$router,'settlementTask');
        },
        // 校验表单
        checkForm(){
            let flag = false;    
            //this.$refs.prpLPayee.validate(valid => {
            this.$refs['prpLPayee'].validate((valid) => {
                //表单验证失败
                if (!valid) {
                    flag = true;
                }
            });
            return flag;
        },
        // 提交
        onSubmit() {
            if(this.checkForm()){
                return;
            }
            if(this.prpLPayee.payAmount != this.prpLSettlementDTO.actualPaymentAmount){
                this.$message.error('实际支付金额与赔款金额不一致'); 
                return;
            }
            this.prpLSettlementDTO.handlerComCode = Cookies.get("makeCom");
            this.prpLSettlementDTO.handlerComName= Cookies.get("cMakeCom");
            this.prpLSettlementDTO.handlerName= Cookies.get("userName");
            this.prpLSettlementDTO.handlerCode= Cookies.get("userCode");
            this.data=this.prpLSettlementDTO;
            this.data.settleCaseInfoList = this.settleCaseInfoList;
            this.data.prpLPayee = this.prpLPayee;
            this.data.taskState = '03';
            this.data.prpLClaimOpinionDTO = this.prpLClaimOpinionDTO;
            // 禁止重复点击
            if(this.loading){
                return;
            }
            this.loading = true;
            submitSettlement(this.data)
                .then(res => {
                      this.loading = false;
                      if(res){
                          if(res.data.resultCode){
                              if(res.data.resultCode != '0000'){ 
                                  // 返回失败
                                  this.$message.error(res.data.resultMsg);
                              }else{
                                  this.$message.success(res.data.resultMsg+',结算单号:'+res.data.settleNo);
                                  this.prpLSettlementDTO.id = res.data.taskId;
                                  this.closePageTo(this.$store,this.$route,this.$router,'settlementTask');
                              }
                          }else{
                              this.$message.error('系统异常'); 
                          }
                      }else{
                        this.$message.error('系统异常'); 
                      }
                  })

        }
    },
    mounted(){
        window.addEventListener('load', () => {
            this.closePageTo(this.$store,this.$route,this.$router);
        })
    }
}
</script>